/**
 * 2
 *  
 * @Author : roryrywang
 * @DateTime : 24-8-28 下午6:59
 */

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v1(n);
    vector<int> v2(n);
    for (int i = 0; i < n; ++i) {
        cin >> v1[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> v2[i];
    }

    int res = 0;
    int j = 0;
    for (int i = 1; i < n; ++i) {
        if (v1[i] - v1[i - 1] == v2[i] - v2[i - 1]) {
            res = max(res, i - j + 1);
        } else {
            j = i;
        }
    }
    res = max(res, n - j);
    cout << res;
    return 0;
}